package com.vivz.guess.what.vo;

import java.util.ArrayList;
import java.util.List;

public class Game {

	/**
	 * A store containing the current game's guess-weight pairs
	 */
	private final List<Guess> guesses = new ArrayList<Guess>();

	/**
	 * A Map of characters to their position probabilities.
	 */
	private final ProbabilityMatrix matrix;

	/**
	 * The number of characters the guess and keyword should have.
	 */
	private final int degree;

	public Game(final int degree) {
		this.degree = degree;
		matrix = new ProbabilityMatrix(degree);
	}

	public boolean addGuess(final Guess guess) {
		final boolean guessAdded;
		if (guess.getLength() == degree) {
			if (guesses.contains(guess)) {
				guessAdded = false;
			} else {
				guessAdded = true;
				guesses.add(guess);
			}
		} else {
			guessAdded = false;
		}
		return guessAdded;
	}

	public List<Guess> getGuesses() {
		return guesses;
	}

	public ProbabilityMatrix getMatrix() {
		return matrix;
	}

	public int getDegree() {
		return degree;
	}

}
